#pragma once

#include "precomp.h"
#include "utils.h"
#include <list>

using std::list;

enum WorkMode {
	UDP,
	TCPClient,
	TCPServer,
};

class Bridge
{
public:
	Bridge();
	~Bridge();

public:
	const char *comPath;
	ComParams *pComParams;
	const char *pIF;
	const char *pIP;
	const char *pPort;
	const char *pLocalPort;
	Protocol *pProtocol;

	WorkMode mode;

	SOCKET CreateSocket();
	BOOL SetAddr(struct sockaddr_in &sn, const char *pAddr, const char *pPort);
	static Bridge *LoadFromRegistry(const char *comName);
	BOOL SaveToRegistry();
	static list<Bridge *> LoadFromDB();
};

